home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-01 | 3.1 KB | 90 lines | [TEXT/R*ch] |
- THE PROPOSED GRAPHICS FOR ABC
-
- There is a proposed graphics interface for ABC. I won't describe it
- totally here (a good candidate for the next newsletter) but I'll just
- give an overview (the details may differ in the final version).
-
- There are a number of functions that return 'pictures'. You may store
- these in the normal way in locations, return them from your own
- functions, and pass them as parameters to functions and commands in
- the usual way.
-
- To quote from the design document, when considering the choice of primitives:
-
- Some objectives for the selection process are:
- - minimize the number of functions; use monadic and dyadic versions
- wherever useful;
- - choose high level functions;
- - combinations of operations should be meaningful;
- - there should be no unnecessary user concern with coordinates;
- - appropriate defaults should be chosen;
- - creating simple pictures must be simple, yet creating
- extensive pictures not too complicated;
- - it must be user friendly, no unexpected effects should occur;
- - the functions should be powerful and versatile;
- - the functions should be logical and should match fair expectation;
- - the functions should be easily extensible;
- - the functions should have mnemonic names.
- So, summarising: in the spirit of ABC .
-
- The idea is that the functions give a useful default behaviour in as
- many cases as possible, but allow you complete control where you need it.
-
- For instance:
-
- DISPLAY box text "Hello!"
-
- will display the text "Hello!" centred on the screen with a box around
- it. Pictures can be combined, like:
-
- DISPLAY (box text "Hello") line (box text "there!")
-
- to join the two boxes with a line.
-
- If 'points' is a sequence of points (x, y), then
-
- DISPLAY polyline points
-
- will draw a graph of the points by joining them up with lines; or
-
- DISPLAY box polyline points
-
- to draw a box round the graph, or using the function 'pile' that
- positions two pictures one above the other, to add a caption:
-
- DISPLAY pile {[1]: box polyline points; [2]: text "Pretty!"}
-
- 'row' works similarly, but horizontally.
-
- To get an empty box of a certain size, you put it round an invisible
- object of the size required:
-
- HOW TO RETURN oblong(h, w): RETURN box (invisible line(w, h))
-
- 'line(x, y)' produces a line from (0, 0) to relative position (x, y).
-
- So, to draw a histogram of a sequence of numbers:
-
- HOW TO RETURN hist seq:
- SHARE bar.width
- PUT {} IN boxes
- FOR x IN seq:
- APPEND oblong(bar.width, x) TO boxes
- RETURN row boxes
-
- >>> DISPLAY hist {1..10}
-
- Now the big question: the implementation. Graphics is just one more of
- the million things Not Yet Implemented.
-
- Lon Barfield has implemented much of the ABC graphics for our Next
- Project, Views, and I have a test version for ABC running in an xterm
- window under X windows.
-
- The question for us is: do we put this in ABC, or do we add ABC to
- Views, and what priority should it have? Officially, ABC is not a
- research project anymore, and we're only doing 'maintenance' on the
- system. If only we had, let's say, 5 more programmers... If only
- programming-language research were glossy enough to attract Big
- Money... :-)
-